package com.kk.single;

import com.kk.utils.AdvanceThreadPool;

/**
 * 懒汉式: 枚举.
 */
enum Singleton {
    //one obj
    INSTANCE;
}

/**
 * 懒汉式: 枚举
 *
 * @author 王志强
 * @date 2021-12-10
 */
public class Singleton5 {
    public static void main(String[] args) {
        for (int i = 0; i < 1000; i++) {
            AdvanceThreadPool.poolExecutor.submit(() -> {
                Singleton instance = Singleton.INSTANCE;
                System.out.println(instance.hashCode());
            });
        }
    }
}